import request from "@/config/index";
const baseUrl = "crm/project";

/*-------------------------------自定义字段--------------------------------------*/
// 列表
export const ApiFieldsList = (params: any) => {
	return request.get({ url: `${baseUrl}/biz-config`, params });
};

// 字段-查询业务下所有的字段
export const selectCofnig = (params: any) => {
	return request.get({ url: `${baseUrl}/select-cofnig`, params });
};

// 添加
export const addField = (data: any) => {
	return request.post({ url: `${baseUrl}/add-field`, data });
};
// 修改字段排序
export const sortChange = (data: any) => {
	return request.post({ url: `${baseUrl}/sort-change`, data });
};
// 修改字段排序
export const sortChangeBiz = (data: any) => {
	return request.post({ url: `${baseUrl}/sort-change-biz`, data });
};

// 修改
export const updateField = (data: any) => {
	return request.post({ url: `${baseUrl}/update-field`, data });
};

// 字段分组-获取业务下的所有字段分组
export const fieldGroup = (params: any) => {
	return request.get({ url: `${baseUrl}/field_group`, params });
};

// 字段分组-新增字段分组
export const addFieldGroup = (data: any) => {
	return request.post({ url: `${baseUrl}/add-field-group`, data });
};

// 字段分组-编辑字段分组信息
export const updateFieldGroup = (data: any) => {
	return request.post({ url: `${baseUrl}/update-field-group`, data });
};

// 字段分组-删除字段分组
export const deleteFieldGroup = (params: any) => {
	return request.get({ url: `${baseUrl}/delete-field-group`, params });
};


// 业务-根据id查询某个业务
export const queryBiz = (params: any) => {
	return request.get({ url: `${baseUrl}/query-biz`, params });
};


// 业务-根据id查询某个业务
export const deleteField = (params: any) => {
	return request.get({ url: `${baseUrl}/delete-field`, params });
};

export const queryConfig = (params: any) => {
	return request.get({ url: `${baseUrl}/query-config`, params });
};
// 字段-批量修改字段所属的分组
export const configChangeGroup = (data: any) => {
	return request.post({ url: `${baseUrl}/config-change-group`, data });
};


// 关系型字段获取数据
export const queryRalation = (data: any) => {
	return request.post({ url: `${baseUrl}/query-relation`, data });
};


// 业务-新增业务类型
export const bizAdd = (data: any) => {
	return request.post({ url: `${baseUrl}/biz-add`, data });
};

export const bizUpdate = (data: any) => {
	return request.post({ url: `${baseUrl}/biz-update`, data });
};
// 权限-新增权限信息
export const roleAdd = (data: any) => {
	return request.post({ url: `/crm/role/role-add`, data });
};


// 权限-编辑权限信息
export const roleUpdate = (data: any) => {
	return request.post({ url: `/crm/role/role-update`, data });
};